<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .li-normal {
            color: #00f
        }

        .li-selected {
            color: red
        }
    </style>
</head>

<body>
    <main id="app">
        <ul>
            <li 
            v-for="item in list" 
            :key="item.id" 
            :class="{'li-normal': true,'li-selected': item.selected}"
            @click="handleSlected(item)"
            >
            {{item.name}}
            <ul>
                <li v-for="item2 in item.children">{{item2}}</li>
            </ul>
        </li>
        </ul>
    </main>
</body>
<script src="../vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                list: [

                ]
            }
        },
        mounted() {
            this.list = [
                { name: "Hydra1", id: 1,selected: false },
                { name: "Hydra2", id: 2,selected: false },
                { name: "Hydra3", id: 3,selected: false },
                { name: "Hydra4", id: 4,selected: false },
                { name: "Hydra5", id: 5,selected: false },
                { name: "Hydra6", id: 6,selected: false },
            ]
        },
        methods: {
            handleSlected(item) {
                console.log(item);
                this.list.forEach(v => v.selected = v.id == item.id)
            }
        }
    });
</script>

</html>